# -*- perl -*-

use Test::More 'no_plan';
use Test::Exception;
use strict;
use warnings;
use Error::Common;

throws_ok {
  Error::IllegalArgument->throw( -number   => 3,
				 -expected => 'CODE',
				 -got      => 'HASH',
			       );
}
  'Error::IllegalArgument',
  'threw';

is( $@->stacktrace, <<TEXT,
Expected CODE, got HASH as third argument of Test::Exception::throws_ok at t/002_throw.t line 10
\tTest::Exception::throws_ok() called at t/002_throw.t line 15
TEXT
    'error description'
);

$Error::Debug = 0;

throws_ok {
  Error::IllegalArgument->throw( -number   => 2,
				 -expected => 'CODE',
				 -got      => 'HASH',
			       );
}
  'Error::IllegalArgument',
  'threw';

is( $@->stacktrace, <<TEXT,
Expected CODE, got HASH as second argument of Test::Exception::throws_ok at t/002_throw.t line 33.
TEXT
    'error description'
);

